﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gurucore.FrameworkTest.DataAccess
{
	public sealed class User_Transformer : DTOTransformer
	{
		public override List<T> Transform<T>(System.Data.IDataReader p_reader)
		{
			List<T> resultObjs = new List<T>();

			int nReadColumn = p_reader.FieldCount;
			p_reader.GetName


			while (p_oReader.Read())
			{
				User oDTO = new User();
				
				oDTO.Id = p_reader["test_User.Id"];
				oDTO.Username = p_reader["test_User.Username"];
				oDTO.Password = p_reader["test_User.Password"];
				oDTO.GroupId = p_reader["test_User.Id"];

				<ad:foreach collection="#properties#" var="property">
				if (((arrColumn == null) || (arrColumn.Count == 0) || (arrColumn.Contains("#property.Name#"))) && (p_oReader["#property.Name#"] != DBNull.Value))
				{
					oDTO._#property.Name# = (#property.Type#)Convert.ChangeType(p_oReader["#property.Name#"], typeof(#property.Type#));
					oDTO._#property.Name#State = DTOColumnState.Unchanged;
				}
				</ad:foreach>

				arrDTO.Add((T)Convert.ChangeType(oDTO, typeof(T)));
			}
		}
	}
}
